<?php
/**
 * Controlador de Barra de menu
 *
 * @author Carlos Enrique Peña Albarrán
 * @package cooperativa.system.application
 * @version 1.0.0
 */
class CMenu extends Model {
	/**
	 * HTML
	 * @var string
	 */
	public $strHTML;

	public function getHtml_Menu($intNivel) {
		$this->load->model('CListartareas');
		$Conectados = $this -> CListartareas -> Usuarios_Conectados_Chat();
		$Menu_C = "";
		//Configurar
		$Menu_B = "";
		//Buzon
		$Menu_P = "";
		//Procesar
		$Menu_I = "";
		//Inventario
		$Menu_I_P = "";
		//Inventario Principal
		$Menu_E = "";
		$Menu_Cobranza = '';

		$Menu_B = '<td><a href="' . base_url() . 'index.php/cooperativa/buzon" border=0><img src="' . __IMG__ . 'menu/correo.png"><br> 
			<center>Buz&oacute;n</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		$Menu_P = '<td><a href="' . base_url() . 'index.php/cooperativa/procesar" border=0><img src="' . __IMG__ . 'menu/procesar.png"><br>
			<center>Procesar</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		$Menu_C = '<td><a href="' . base_url() . 'index.php/cooperativa/configurar" border=0><img src="' . __IMG__ . 'menu/configurar.png"><br>
			<center>Configurar</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		$Menu_I = '	<td><a href="' . base_url() . 'index.php/cooperativa/Listar_Inventario" border=0><img src="' . __IMG__ . 'menu/inventario.png"><br>
			<center>Inv. List</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		// ---------------------
		$Menu_I_P = '';

		$Menu_E = '<td><a href="' . base_url() . 'index.php/cooperativa/Estadistica" border=0><img src="' . __IMG__ . 'menu/estadistica.gif"><br>
			<center>Estadistica</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		$Menu_H = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial" border=0><img src="' . __IMG__ . 'menu/estadistica.gif"><br>
			<center>Historial</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		$Menu_Cobranza = '<td><a href="' . base_url() . 'index.php/cooperativa/Cobranza" border=0><img src="' . __IMG__ . 'menu/cobranza.png"><br>
			<center>Cobranza</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
		switch ($intNivel) {
			case 1 :
				$Menu_C = '';
				$Menu_E = '';
				$Menu_I = '	';
				$Menu_B = '<td><a href="' . base_url() . 'index.php/cooperativa/Sugerencia" border=0><img src="' . __IMG__ . 'menu/correo.png"><br> 
			<center>Buz&oacute;n</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';			
				break;
			case 2:
				$Menu_B = '<td><a href="' . base_url() . 'index.php/cooperativa/Sugerencia" border=0><img src="' . __IMG__ . 'menu/correo.png"><br> 
			<center>Buz&oacute;n</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';			
				$Menu_P = '<td><a href="' . base_url() . 'index.php/cooperativa/procesar" border=0><img src="' . __IMG__ . 'menu/procesar.png"><br>
					<center>Procesar</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				$Menu_C = '';
				$Menu_I = '	';
				$Menu_E = '';
				$Menu_H = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial" border=0><img src="' . __IMG__ . 'menu/estadistica.gif"><br>
					<center>Historial</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';	
				//Historial de Contratos
				$Menu_Cobranza = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial_Contratos" border=0><img src="' . __IMG__ . 'menu/quehice.png"><br>
					<center>Que Hice</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				break;
			case 3 :
				$Menu_C = '';
				$Menu_B = '<td><a href="' . base_url() . 'index.php/cooperativa/Contratos_Liberacion" border=0><img src="' . __IMG__ . 'menu/correo.png"><br> 
			<center>Buz&oacute;n</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				$Menu_Cobranza = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial_Contratos" border=0><img src="' . __IMG__ . 'menu/quehice.png"><br>
					<center>Que Hice</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				break;
			case 5:
				$Menu_B = '<td><a href="' . base_url() . 'index.php/cooperativa/Sugerencia" border=0><img src="' . __IMG__ . 'menu/correo.png"><br> 
			<center>Buz&oacute;n</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';			
				$Menu_P = '<td><a href="' . base_url() . 'index.php/cooperativa/procesar" border=0><img src="' . __IMG__ . 'menu/procesar.png"><br>
					<center>Procesar</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				$Menu_C = '';
				$Menu_I = '	';
				$Menu_E = '';
				$Menu_H = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial" border=0><img src="' . __IMG__ . 'menu/estadistica.gif"><br>
					<center>Historial</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';	
				//Historial de Contratos
				$Menu_Cobranza = '<td><a href="' . base_url() . 'index.php/cooperativa/Historial_Contratos" border=0><img src="' . __IMG__ . 'menu/quehice.png"><br>
					<center>Que Hice</center></a></td><td valign="middle" style="width: 30px" align="center"></td>';
				break;
							
			default :
				break;
				
		}


		$this -> strHTML = '
	<link type="text/css" rel="stylesheet" media="all" href="'.__CSS__.'chat.css" />
	<link type="text/css" rel="stylesheet" media="all" href="'.__CSS__.'screen.css" />
	<link href="'.__CSS__.'ui-lightness/jquery-ui-1.8.6.custom.css" rel="stylesheet"  type="text/css">
	<script type="text/javascript" src="'.__JSVIEW__.'nomina/chat.js"></script>
	<script type="text/javascript" src="'.__JSVIEW__.'nomina/jquery.js"></script>
	<script type="text/javascript" src="'.__JSVIEW__.'jquery-ui-1.8.6.custom.min.js"></script>
	
	<script type="text/javascript">
		$(document).ready(function(){
			originalTitle = document.title;
			startChatSession("'.__LOCALWWW__.'");

			$([window, document]).blur(function(){
				windowFocus = false;
			}).focus(function(){
				windowFocus = true;
				document.title = originalTitle;
			});
		});
		
		$(function() {
		$("#conectados_chat" ).accordion({
			collapsible: true,
			active: 2,
			autoHeight: false,
			navigation: true
		});
		$("#proformas" ).accordion({
			collapsible: true,
			active: 2,
			autoHeight: false,
			navigation: true
		});
		});
			</script>
			<div id="BarraMenu">
			<table border="0" height="75px" >
			<tr><td style="width: 20px;">&nbsp</td>
					' . $Menu_B . '					
				<td>
					<a href="' . base_url() . 'index.php/cooperativa/registrar" border=0>
						<img src="' . __IMG__ . 'menu/personales.png"><br>
						<center>Registrar</center>
					</a>
				</td>
				<td valign="middle" style="width: 30px" align="center">
				</td>	' . $Menu_P . '			
				<td>
					<a href="' . base_url() . 'index.php/cooperativa/reportes" border=0>
					<img src="' . __IMG__ . 'menu/imprimir.png"><br>
						<center>Reportes</center>	
					</a>
				</td>
					
				<td valign="middle" style="width: 30px" align="center">
				</td>
				' . $Menu_E . $Menu_I . $Menu_I_P . $Menu_Cobranza . $Menu_C . '	
				
				<td>
					<a href="' . base_url() . 'index.php/cooperativa/logout" border=0>
						<img src="' . __IMG__ . 'menu/salir.png"><br>
						<center>Salir</center>
					</a>
				</td>
				<td valign="middle" style="width: 20px">
				</td>
				<td valign=bottom align="center">
					

				</td>
				
			</tr>
		</table><br>
		<table>
		<tr><td style="width:20px"></td><td>
				<form method="POST" id="frmBuscar" action="' . base_url() . 'index.php/cooperativa/procesar" name="frmBuscar">
					<table><tr><td valign="top"> 
						<select name="txtForma" id="txtForma" class="inputxt" style="width:150px;height:22px">
							<option value="V-">Venezolano (a)</option>
							<option value="E-">Extranjero (a)</option>
							<option value="C-">Contrato</option>
							<option value="F-">Factura</option>
							<option value="S-">Serial Activo</option>
							<option value="SV-">Serial Vendido</option>
						</select>
						</td><td valign="top">
						<input class="inputxt" name="txtBuscar" id="filter"  type="text" value="C&eacute;dula o Contrato" 
						onclick="this.value=\'\';" style="width:200px;height:22px" \>
						
						</td><td valign="top">
						<input class="inputxt" id="searchsubmit" value="Buscar " type="submit" style="height:22px">
					</td></tr></table>
				</form>
				</td>
			
				
			</tr>
		</table>
		</div>';

		return $this -> strHTML;
	}

	public function __construct() {
		parent::Model();
	}

}
?>